<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <a class="btn btn-info" href="{:U('add')}" value="">新增</a>
                                <div class="space-4"></div>
                                <table class="table table-striped table-bordered table-hover" id="tblist">
                                    <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>域名</th>
                                            <th>层级</th>
                                            <th>状态</th>
                                            <th>操作</th>

                                        </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="data.list" id="vo">
                                        <tr>
                                            <td>{$vo.id}</td>
                                            <td>{$vo.domain}</td>
                                            <td>{$vo.level}</td>
                                            <td>
                                                <if condition="$vo['status'] eq 0">待启用</if>
                                                <if condition="$vo['status'] eq 1" ><strong>启用</strong></if>
                                                <if condition="$vo['status'] eq 2" >拦截</if>

                                            </td>
                                            <td>
                                            <if condition="$vo['status'] eq  0">【<a href="#" class="link-setting" data-value='1' data-id="{$vo.id}">启用</a>】</if>
                                            <if condition="$vo['status'] eq 1">【<a href="#"  class="link-setting" data-value='2' data-id="{$vo.id}">拦截</a>】</if>
                                             <if condition="$vo['status'] eq 2">【<a href="#"  class="link-setting" data-value='1' data-id="{$vo.id}">恢复</a>】</if>   
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>

                                </table>
                                {$data.page}
                            </div>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(".link-setting").on("click" , function(){
        
        var status = $(this).attr("data-value");
        var id = $(this).attr("data-id");
        $.post("{:U('change_domain_status')}" , {status:status,id:id} , function(data){
            if(data.status == 1){
                layer.alert(data.msg , function(){
                    window.location.reload();
                })
            }else{
                layer.alert(data.msg);
            }
        })
    })
</script>
</body>
</html>
